<template>
  <div class="svg-icon" :style="{ width: size, height: size }">
    <img :src="iconPath" :alt="name" class="w-full h-full" />
  </div>
</template>

<script setup>
import { computed } from "vue";

const props = defineProps({
  name: {
    type: String,
    required: true,
  },
  size: {
    type: String,
    default: "100%",
  },
});

const iconPath = computed(() => {
  return `/icons/weather/${props.name}.svg`;
});
</script>

<style lang="scss" scoped>
.svg-icon {
  display: inline-block;
  vertical-align: middle;
}
</style>
